<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //获取时间戳法1：通过日期对象的valueOf()和getTime()方法
        var date1 = new Date();
        console.log(date1.getTime());
        console.log(date1.valueOf());

        //获取时间戳法2：通过使用+运算符转换为数值型
        var date2 = new Date();
        console.log(+date2);

        //获取时间戳法3：通过使用html5新增的Date.now()方法
        var date3 = new Date();
        console.log(Date.now());
    </script>
    
</head>
<body>
    
</body>
</html>